<template>
  <div class="login">
    <Header></Header>
    <leftmenu :leftMenuTrees="leftMenuTrees" @leftMenuNav="leftMenuNav"></leftmenu>
    <keep-alive>
      <router-view class="home-main"></router-view>
    </keep-alive>
    <Footer></Footer>
  </div>
</template>

<script>
  /* import Vue from 'vue'
  import axios from 'axios';
  import qs from 'qs'; */
  import store from '../store/index.js';
  import leftmenu from './common/leftmenu.vue';
  import Header from './common/Header.vue';
  import Footer from './common/Footer.vue';
  import {leftMenuTree} from '@/request/api'; // 导入我们的api接口
  export default {
    name: 'home',
    data: function() {
      return {
        msg: 'Welcome to Your Vue.js App 钟海',
        leftMenuTrees: ''
      }
    },
    created: function() {
      let that = this;
      console.log(store);
      /* let tokenInfo = JSON.parse(sessionStorage.getItem('tokenInfo'));
      let baseurl = JSON.parse(sessionStorage.getItem('baseurl', baseurl));
      let url = '/admin/role/leftMenuTree'
      let formdata = new FormData;
      formdata.append('id', '123455')
      *//* axios.post(baseurl+url,that.$qs.stringify({id:'123456'}),
            {headers: {'Authorization': tokenInfo.accessToken}})
        .then(res => {
          console.log(res);
        })
        .catch(e => fn) */

      leftMenuTree({}).then(res => {
        console.log(JSON.stringify(res.data));
        this.leftMenuTrees = res.data;
      });
    },
    methods: {
      addDelStatus: function(index) {
        this.curId = index
      },
      leftMenuNav: function(e) {
        let url = e.$attrs.data_url;
        let parentId = e.$attrs.data_id;
        this.$router.push({
          path: url,
          query: {
            parentId: parentId
          }
        });
      }

    },
    components: {
      leftmenu,
      Header,
      Footer,
    }
  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
  h1,
  h2 {
    font-weight: normal;
  }

  ul {
    list-style-type: none;
    padding: 0;
  }

  li {
    display: inline-block;
    margin: 0 10px;
  }

  a {
    color: #42b983;
  }

  .login {
		
	}

  .input-msg {}

  .logo {
    text-align: center;
    padding: 20px 0;
  }

  .home-main {
    position: absolute;
    top: 50px;
    left: 200px;
    bottom: 60px;
    right: 0;
    z-index: 11;
    padding: 20px 15px;
    overflow: auto;
  }

  /* 公共弹窗样式修改--s*/
  .el-dialog--center .el-dialog__body {
    padding-top: 0;
  }

  .dialog-footer {
    margin-top: 15px;
  }

  /* 公共弹窗样式修改--d*/
</style>
